#
# Makefile for misc devices that really don't fit anywhere else.
#



define FILTER_PROJECT_DRV
ifeq ($(wildcard $(srctree)/drivers/misc/mediatek/imgsensor/src/$(MTK_PLATFORM)/camera_project/$(ARCH_MTK_PROJECT)/$(1)),)
platform_drv += $(1)
else
project_drv += camera_project/$(ARCH_MTK_PROJECT)/$(1)
endif
endef

MTK_PLATFORM := $(subst ",,$(CONFIG_MTK_PLATFORM))
ARCH_MTK_PROJECT := $(subst ",,$(CONFIG_ARCH_MTK_PROJECT))

obj-y				+= kd_sensorlist.o

$(info -= project path  $(srctree)/drivers/misc/mediatek/imgsensor/src/$(MTK_PLATFORM)/camera_project/$(ARCH_MTK_PROJECT)/ =-)

#ifneq ($(wildcard $(srctree)/drivers/misc/mediatek/imgsensor/src/mt6735m/camera_project/$(ARCH_MTK_PROJECT)/camera_hw),)
#obj-y				+= camera_project/$(ARCH_MTK_PROJECT)/camera_hw/
#$(info by porject kd_camera_hw)
#else
#obj-y                           += camera_hw/
#endif

obj-y                           += camera_hw/


$(foreach drv,$(subst $\",,$(CUSTOM_KERNEL_IMGSENSOR)),$(eval $(call FILTER_PROJECT_DRV,$(drv))))
custom_kernel_imgsensor_by_platform := $(addsuffix /, $(shell echo $(platform_drv)))
custom_kernel_imgsensor_by_project := $(addsuffix /, $(shell echo $(project_drv)))

# obj-y += $(custom_kernel_imgsensor_by_platform)
# obj-y += $(custom_kernel_imgsensor_by_project)


IMGSENSOR_LISTS := $(subst ",,$(CUSTOM_KERNEL_IMGSENSOR))
obj-y += $(foreach SENSOR,$(IMGSENSOR_LISTS), $(SENSOR)/)
$(info imgsensor drv by platform $(platform_drv))
$(info imgsensor drv by project $(project_drv))
